package com.share.strategicMode.cashier;

public class Run {
    /**
     *
     * @param args
     */
    public static void main(String[] args) {
        int discountType = 1;//打折类型
        double price = 1000d;//单价
        int num = 10;//数量
        double totalPrices;//总价
        double total = 0d;//总价
        CashContext cc = null;

        switch (discountType){
            case 1:
                cc = new CashContext(new CashNormal());
                break;
            case 2:
                cc = new CashContext(new CashRebate(0.8d));
                break;
            case 3:
                cc = new CashContext(new CashRebate(0.7d));
                break;
            case 4:
                cc = new CashContext(new CashReturn(300,100));
                break;

        }
        totalPrices = cc.getResult(price,num);
        total  = totalPrices + total;
        System.out.println("total:"+total);
    }
}
